package lab4;

import java.awt.geom.Point2D;

public class PointPair {
	private Point2D p1;
	private Point2D p2;
	private double distance;
	
	public PointPair(Point2D p1, Point2D p2){
		this.p1 = p1;
		this.p2 = p2;
		distance = p1.distance(p2);
	}
	
	public Point2D getP1() {
		return p1;
	}
	
	public Point2D getP2() {
		return p2;
	}
	
	public double minDistance(PointPair pair) {
		if(this.distance() < pair.distance())
			return this.distance();
		
		return pair.distance();
	}
	
	public double distance() {
		return distance;
	}
}
